package com.ctp.core.uuid;

import java.util.UUID;

/**
 * Created by Lxy on 2025/1/11 12:46
 */

public class UUIDUtils {

    /**
     * 获取指定长度的随机字符串
     * @param length 长度
     * @return UUID String
     */
    public static String getRandomUUIDString(int length) {

        String replace = UUID.randomUUID().toString().replace("-", "");

        if (replace.length() < length || length <= 0)
            return replace;

        return replace.substring(0, length);
    }
}
